//
//  MyCardRulesVC.m
//  WanCaiC8
//
//  Created by tangang on 2018/3/28.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "MyCardRulesVC.h"

@interface MyCardRulesVC ()

@end

@implementation MyCardRulesVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"查看券规则";
    [self createUI];
    // Do any additional setup after loading the view.
}

- (void)createUI{
    QXLable *lab=[[QXLable alloc]initWithFount:12];
    NSMutableAttributedString *attStr=[[NSMutableAttributedString alloc]initWithString:@"获取方式\n老用户邀请新用户注册成功可获得查看券，新用户注册成功也可获得查看券。"];
    [attStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:15] range:NSMakeRange(0, 4)];
    NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
    paraStyle.lineBreakMode = NSLineBreakByCharWrapping;
    paraStyle.lineSpacing = 10; //设置行间距
    [attStr addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, attStr.length)];
    lab.attributedText=attStr;
    [self.view addSubview:lab];
    float height=[TGTools getSpaceLabelHeight:attStr.string withFont:[UIFont systemFontOfSize:12] withWidth:SCREEN_WIDTH-20 andLineSpacing:10];
    [lab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.view).with.offset(10);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-20, height+30));
    }];
    
    UIImageView *bgImage=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"card_rules_bg"]];
    [self.view addSubview:bgImage];
    [bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.equalTo(lab.mas_bottom);
        make.size.mas_equalTo(bgImage.image.size);
    }];
    
    QXLable *lab1=[[QXLable alloc]initWithFount:12];
    NSMutableAttributedString *attStr1=[[NSMutableAttributedString alloc]initWithString:@"使用说明\n1、查看券来源于被邀请新用户注册成功可获取1张查看券，老用户邀请新用户成功也可获得1张查看券，非邀请首次注册成功新用户也可获得查看券1张。查看券当天有效，过期无效。\n2、查看券用于免费查看付费高手计划，使用查看券之前必须先关注高手，成为高手的粉丝才能使用查看券。"];
    [attStr1 addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:15] range:NSMakeRange(0, 4)];
    [attStr1 addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, attStr1.length)];
    lab1.attributedText=attStr1;
    [self.view addSubview:lab1];
    float height1=[TGTools getSpaceLabelHeight:attStr1.string withFont:[UIFont systemFontOfSize:12] withWidth:SCREEN_WIDTH-20 andLineSpacing:10];
    [lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bgImage.mas_bottom);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-20, height1+30));
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
